<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent{
            display: flex;
        }
        .child{
            width:200px;
            height: 60px;
            background:url(images/green.png) no-repeat;
            margin-right: 1px;
            text-align: center;
            line-height: 60px;
            color:gray;
        }
        .over{
            background:url(images/blue.png) no-repeat;
            color:white;
        }
        .out{
            background:url(images/green.png) no-repeat;
            color:gray;
        }
    </style>
    <script>    
         window.onload=function(){
            var divs=document.querySelectorAll(".child");
       
            for(var i=0;i<divs.length;i++){
                divs[i].onmouseover=function(){
                    this.style.background="url(images/blue.png) no-repeat";
                };
                divs[i].onmouseout=function(){
                    this.style.background="url(images/green.png) no-repeat";
                };
            }
         };
    </script>
</head>

<body>
    <div class="parent">

        
        <div class="child">南京</div>
        <div class="child">上海</div>
        <div class="child">北京</div>
    </div>
</body>

</html>